<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="__STATIC__/index/css/zs_common.css">
  <link rel="stylesheet" href="__STATIC__/index/css/quan_common.css">
  <link rel="stylesheet" href="__STATIC__/index/css/single.css">
  <link rel="stylesheet" href="__STATIC__/index/css/common.css">
  <link rel="stylesheet" href="__STATIC__/index/css/uc_common.css">
  <link rel="stylesheet" href="__STATIC__/index/css/all.css">
  <link rel="stylesheet" href="__STATIC__/index/css/post_goods.css">
  <script src="__STATIC__/index/js/jquery-3.2.1.js"></script>
  <script src="__STATIC__/layui/layui.js"></script>
  <title>商品提交</title>
  <style>
    label.checkbox-inline i, label.radio-inline i, label.radio-inline.disabled:hover i{
    background: url('__STATIC__/index/img/uc-pic.png') no-repeat;
  }
  /*label.checkbox-inline i, label.radio-inline i, label.radio-inline.disabled:hover i{
  	background: url('__STATIC__/index/img/uc-pic.png');
  	top:0!important;
  }*/
  </style>
</head>
 <script type="text/javascript">
	 function tijiao(){
		 	var sp_url = $('#sp_url').text();
		 	var sp_fl = $('#sp_fl').val();
		 	var d_title = $('#d_title').val();
		 	var tp_url = $('#tp_url').val();
		 	var sp_wa = $('#sp_wa').val();
		 	var sp_yhj = $('#sp_yhj').val();
		 	var sp_rj = $('#sp_rj').val();
		 	var sp_jhj = $('#sp_jhj').val();
		 	var sp_sl = $('#sp_sl').val();
		 	var promotion = $('#promotion').val();
		 	var xiaoliang = $('#xiaoliang').val();
		 	var sp_yhjje = $('#sp_yhjje').val();
		 	var sp_sysl = $('#sp_sysl').val();
		 	var sp_time = $('#sp_time').val();
		 	var sp_id = $('#sp_id').val();
		 	var yhj_id = $('#yhj_id').val();
		 	var num = $(".start_type_now.cur").find("input").val();
		 	var end_time = $('#end_time').val();
					 	if(num == 2){
					 		  var start_time = $('#start_time').val();
					 		  if(start_time==''){
					 		  layui.use('layer', function(){
									  var layer = layui.layer;
									  layer.alert('请选择预售时间', {icon: 2});
										});              
								 		return false;
					 		  }
					   }else{
					   	  var start_time = '';
					   }
					 	
		 	      if(sp_fl == 0){
		     			layui.use('layer', function(){
						  var layer = layui.layer;
						  layer.alert('请选择商品分类', {icon: 2});
							});              
					 		return false;
		     		}
		     		if(d_title==''){
		     			layui.use('layer', function(){
						  var layer = layui.layer;
						  layer.alert('请填入商品标题', {icon: 2});
							});              
					 		return false;
		     		}
		     		if(tp_url==''){
		     			layui.use('layer', function(){
						  var layer = layui.layer;
						  layer.alert('请填入图片地址', {icon: 2});
							});              
					 		return false;
		     		}
		     		if(sp_wa==''){
		     			layui.use('layer', function(){
						  var layer = layui.layer;
						  layer.alert('请填写文案', {icon: 2});
							});              
					 		return false;
		     		}
		     		if(sp_yhj==''){
		     			layui.use('layer', function(){
						  var layer = layui.layer;
						  layer.alert('请填写优惠劵地址', {icon: 2});
							});              
					 		return false;
		     		}
		     		
		     		if(promotion==''){
		     			layui.use('layer', function(){
						  var layer = layui.layer;
						  layer.alert('请填写要推广的数量', {icon: 2});
							});              
					 		return false;
		     		}
		     		
		     	if(sp_rj==''){
		     			layui.use('layer', function(){
						  var layer = layui.layer;
						  layer.alert('请填写佣金', {icon: 2});
							});              
					 		return false;
		     		}
		 	      if(sp_jhj==''){
		     			layui.use('layer', function(){
						  var layer = layui.layer;
						  layer.alert('请填写劵后价', {icon: 2});
							});              
					 		return false;
		     		}
		 	      if(sp_sl==''){
		     			layui.use('layer', function(){
						  var layer = layui.layer;
						  layer.alert('请填写优惠劵数量', {icon: 2});
							});              
					 		return false;
		     		}
		 	      if(sp_yhjje==''){
		     			layui.use('layer', function(){
						  var layer = layui.layer;
						  layer.alert('请填写优惠劵面值', {icon: 2});
							});              
					 		return false;
		     		}
		 	      if(end_time == ''){
					 		 layui.use('layer', function(){
							 var layer = layui.layer;
							 layer.alert('请选择商品下架时间', {icon: 2});
							 });              
							 return false;
					 	}
		 	      
		 	      if(!$('.have-read').hasClass('cur')){
		 	      	layui.use('layer', function(){
							 var layer = layui.layer;
							 layer.alert('请阅读信息提交规范手册', {icon: 2});
							 });              
							 return false;
		 	      }

		 	    var data = {
     			 web_address:sp_url,
					 cate_id:sp_fl,
					 title:d_title,
					 letters:sp_wa,
     			 coupon_price:sp_yhjje,
     			 coupon_address:sp_yhj,
     			 last_price:sp_jhj,
     			 large_img:tp_url,
     			 money:sp_rj,
     			 shuliang:promotion,
     			 sale_volume:xiaoliang,
     			 sy_coupon_nums:sp_sysl,
     			 coupon_nums:sp_sl,
     			 yhj_time:sp_time,
     			 sp_id:sp_id,
     			 yhj_id:yhj_id,
     			 end_time:end_time,
     			 sale_time:start_time,
     		};   
		 	       
		 	  $.ajax({
		 	  	type:"post",
		 	  	url:"add_seller_new",
		 	  	data:data,
		 	  	success:function(res){
		 	  		if(res.code==1){
			 	  			layui.use('layer', function(){
							  var layer = layui.layer;
							  layer.alert(res.msg, {icon: 1},function(){
							     location.href="{:url('index/seller/myGoods')}";
							  });
							});   
		 	  		}else if(res.code==2){
			 	  			layui.use('layer', function(){
							  var layer = layui.layer;
							  layer.alert(res.msg, {icon: 2},function(){
							     location.reload(); 
						    });
							});
		 	  		}
		 	  		
		 	  	}
		 	  });       
 	      
 	 }
	  
	  function is_url(){
	      var sp_yhj =$('#sp_yhj').val();
	      var sp_url = $('#sp_url').text();
	      if(sp_yhj==''){
	      	layui.use('layer', function(){
						  var layer = layui.layer;
						  layer.alert('请填写优惠劵链接地址', {icon: 2});
							});              
					 		return false;	
	      }
	      var data = {
	      	sp_yhj:sp_yhj,
	      	sp_url:sp_url,
	      };
        $.ajax({
        	type:"post",
        	url:"is_url_add",
          data:data,
          success:function(res){
           if($.isEmptyObject(res)){
           	  layui.use('layer', function(){
						  var layer = layui.layer;
						  layer.alert('请填写有效的链接地址', {icon: 2});
							});              
					 		return false;
           }else{
           if(res.code){
           	  layui.use('layer', function(){
						  var layer = layui.layer;
						  layer.alert(res.sub_msg, {icon: 2});
							});              
					 		return false;	
           }else{
           	$('#sp_yhjje').val(res.coupon_amount);
           	$('#sp_sl').val(res.coupon_total_count);
           	$('#sp_sysl').val(res.coupon_remain_count);
           	var time_arr = res.coupon_start_time+" -- "+res.coupon_end_time;
           	$('#sp_time').val(time_arr);
           	$('#yhj_id').val(res.coupon_activity_id);
            $("#cs_url").hide()
           }
           	 	
           }
       
        }
        });  	 
	  	
	  	
	  }
	 //时间插件
	layui.use('laydate', function(){
  var laydate = layui.laydate;
   laydate.render({
    elem: '#start_time',
    type: 'datetime',
    min:0,
    max:7
  });
  
 });
 
 	layui.use('laydate', function(){
  var laydate = layui.laydate;
   laydate.render({
    elem: '#end_time',
    type: 'datetime',
    min:0,
    max:15
  });
  
 });
 </script>


<body>
  <!-- 头部 -->
  {include file='common/heade'}
  <!-- 中间内容部分 -->
  <div class="single_center w_1200">
   {include file='common/left'}
    <div class="single_r_center">
      <form id="form1" name="form1" method="post" action="">
        <table border="0" cellpadding="0" cellspacing="0" style="min-width: 750px">
          <thead>
            <tr>
              <th width="110"></th>
            </tr>
          </thead>
          <tbody class="zs-tbody">
            <tr>
              <td class="breadcrumb" colspan="2">
                <a class="jump-confirm" href="/tk_zs/quan-order.html">我的商品内容</a>&gt;

                <a class="jump-confirm" href="/tk_zs/check-page.html">发布新单</a>&gt;

                <b>填写商品信息</b>
              </td>
            </tr>
            <tr>
              <td class="zs-big-title" colspan="2">商品信息</td>
            </tr>
            <tr>
              <td class="zs-td-title ">商品地址：</td>
              <td><a href="{$zhiliao.item_url}" target="_blank" id="sp_url">{$zhiliao.item_url}</a>
              </td>
            </tr>

            <!--<tr>
              <td class="zs-td-title ">商品活动：</td>
              <td>
                <label class="radio-inline label-hd hd-0  cur"><i></i><input name="hd_type" value="1" checked="" type="radio">普通</label>
                <label class="radio-inline label-hd hd-1   "><i></i><input name="hd_type" type="radio" value="2">淘抢购</label>
                <label class="radio-inline label-hd hd-2   "><i></i><input name="hd_type" type="radio" value="3">聚划算</label>
                <label class="radio-inline zs-tip" style="cursor: auto">活动优先审核！</label>
              </td>
            </tr>-->

            <tr>
              <td class="zs-td-title ">商品分类：</td>
              <td class="zs-line-height">
              	<select name="sp_fl" id="sp_fl">
              		<option value="0">请选择</option>
              		{foreach $goods_cate as $val}
              		<option value="{$val.id}">{$val.name}</option>
              		{/foreach}
              	</select>
                </td> 
            </tr>
            <tr>
              <td class="zs-td-title">商品标题：</td>
              <td class="zs-line-height">
                <div class="zs-list">
                  <input type="text"  id="d_title" name="d_title" value="{$zhiliao.title}" class="zs-input-text title-text" placeholder="">
                  <p class="zs-error">错误提示</p>
                </div>


              </td>
            </tr>
            <tr class="zs-tip-tr">
              <td></td>
         <td>
          <!--      <p class="zs-tip fl-zs-tip">
                  严禁直接复制淘宝标题， 查看<a href="http://www.dataoke.com/hz_tk/gz/?id=472" target="_blank">《短标题规范》</a>
                </p>-->
              </td>
            </tr>
            <tr>
              <td class="zs-td-title ">商品图片链接：</td>
              <td class="zs-line-height">
                <div class="zs-list">
                  <input type="text" name="pic2"  id="tp_url"  style="border-width: 0px; width: 420px;" class="zs-input-text img-text "
                    value="{$zhiliao.pict_url}" placeholder="">
                  <img class="zs-small-img" src="" width="40px" height="40px" alt="" style="right: 0px;">
                  <img class="zs-large-img" src="" width="120px" height="120px" alt="">
                  <div class="zs-sme-img" style="right: 0px;"></div>
                  <div class="zs-lae-img">
                    <p>图片加载失败</p>
                  </div>
                  <p class="zs-error img-error">您填写的图片预览失败，图片尺寸应为 800X800 或 750X750</p>
                </div>

              </td>
            </tr>
          <!--  <tr class="zs-tip-tr">
              <td></td>
              <td>
                <p class="zs-tip fl-zs-tip">
                  不符合要求将被扣除次数！ <a href="http://www.dataoke.com/hz_tk/gz/?id=588" target="_blank">《主图规范》</a>
                </p>
              </td>
            </tr>-->
         
              <tr class="yxzt-check-type yxzturl" data-goodsid="541089966583" data-yxzt="/tk_zs/qq_pic.html">
              <td class="zs-td-title hight-tip-td">商品营销图：</td>
              <td class="td-up-super-pic">

                <div class="yxzt-img">
                	{foreach $zhiliao.small_images as $key=>$val}
                	 {if($key==0)}
                  <div onclick="yxtTabFun($(this))" class="yxt-img-item cur"><i class="cur_icon"></i><img src="{$val}"></div>
                  {/if}
                  {/foreach}
                 <!-- <div onclick="yxtTabFun($(this))" class="yxt-img-item "><i class="cur_icon"></i><img src="https://thumbnail.dataoke.com//img/datacenterapi/20180319/2018031917152894955544.jpg"></div>
                  <div onclick="yxtTabFun($(this))" class="yxt-img-item "><i class="cur_icon"></i><img src="https://thumbnail.dataoke.com//img/datacenterapi/20180625/2018062519273598529568.jpg"></div>
                    <i class="cur_icon"></i>
                   <div id="container" style="position: relative;">
                      <a class="upLoadImage" id="pickfiles" href="javascript:void(0);" style="z-index: 10;">上传本地图片</a>
                      <span class="text">或</span>
                      <a class="urlLoadImage" href="javascript:;" onclick="upLoadImageUrl();">填写图片链接</a>
                      <span class="uploadDel"><i></i>删除</span>
                      <div id="html5_1ctpm76hdtld13gl1qq916fk1l164_container" class="moxie-shim moxie-shim-html5" style="position: absolute; top: 0px; left: 10px; width: 100px; height: 27px; overflow: hidden; z-index: 9;"><input
                          id="html5_1ctpm76hdtld13gl1qq916fk1l164" type="file" style="font-size: 999px; opacity: 0; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;"
                          multiple="" accept=".jpg,.png,.jpeg"></div>
                    </div>
                    <img src="">
                  </div>
                </div>-->

             <!--   <div class="yxzt-url">
                  <p class="zs-tip">选填，请<span>选择或上传</span>优质营销主图，营销主图的重要性，你懂得！查看<a href="http://www.dataoke.com/hz_tk/gz/?id=635"
                      target="_blank">《营销主图规范》</a><br>仅支持JPG、PNG格式图片，文件小于1M</p>
                  <input type="text" hidden="" name="super_pic" value="">
                </div>-->


              </td>
            </tr>
           

            <tr>
              <td class="zs-td-title hight-tip-td">推广文案：</td>
              <td class="wenan-text">
                <div class="zs-text-area">
                  <textarea type="text" id="sp_wa" name="wenan" maxlength="100" class="zs-input-text" placeholder="如：护发精华+沐浴乳+洗发乳三件套，三瓶都是280ml哦！美女们，赶紧秒起来！超级划算~"></textarea>
                  <!--                                <span class="word_count">当前字数<b>0</b>，还可输入字数<b>100</b>。</span>-->
                </div>

                  <p class="zs-tip" style="margin-top: 6px">
                  20-100字精简文案！突出产品亮点、需求痛点、为什么值得购买！注意不要用空格！ 查看<a href="http://www.dataoke.com/hz_tk/gz/?id=472" target="_blank">《文案规范》</a>
                </p>
              </td>
            </tr>

              <tr>
              <td class="zs-td-title hight-tip-td ">开始时间：</td>
              <td style="padding: 14px 0 34px;">
                <label class="radio-inline start_type_now cur ">
                  <i></i>
                  <input name="start_type" value="1" class="inp_start_type_now" checked="" type="radio">立即开始 <br />
                </label>
                <label class="radio-inline start_type_now ">
                	<i></i>
                  <input name="start_type" value="2" class="inp_start_type_now" checked="" type="radio">预售<br />
                </label  >
	                 <div class="coupon-start-time" data-hour="13" style="width:45%;display:flex;flex-dirction:row;justify-content: flex-end;">
	                    <input type="text" class="layui-input" id="start_time" value=""  placeholder="请选择活动开始时间" style="border-radius:8px;">                 
	                 </div>
              </td>
            </tr>

           
            <tr class="zs-coupon-tr">
              <td class="zs-td-title ">优惠券链接：</td>
              <td>
                <input type="text" id="sp_yhj" value="" name="quan_dwz" class="zs-input-text " placeholder="填写优惠券原始链接">
              <span class="zs-tip" id="cs_url"  onclick="is_url()" style="border:1px solid #5a9ed8;padding:5px;background: #5a9ed8;border-radius:5px;color: #fff;;">请点击检测</span>
              </td>
            </tr>

             <tr class="zs-price-tr">
              <td class="zs-td-title ">优惠劵面值：</td>
              <td class="zs-line-height">
                <input type="text" id="sp_yhjje" value="" name="yuanjia" class="zs-input-text zs-input-short fl" disabled="disabled">
                <span class="zs-short-tip fl">元</span>
               <!-- <span class="zs-tip">填写优惠劵的面值！</span>-->
              </td>
            </tr>
            <tr class="zs-couponnum-tr">
              <td class="zs-td-title ">优惠券总量：</td>
              <td class="zs-line-height">
                <input type="text" id="sp_sl" value="" name="quan_num" class="zs-input-text zs-input-short fl " disabled="disabled">
                <span class="zs-short-tip fl">张</span>
                <!--<span class="zs-tip">优惠券原始总量，非剩余量！</span>-->
              </td>
            </tr>
            
             <tr class="zs-couponnum-tr">
              <td class="zs-td-title ">优惠券剩余量：</td>
              <td class="zs-line-height">
                <input type="text" id="sp_sysl" value="" name="quan_num" class="zs-input-text zs-input-short fl " disabled="disabled">
                <span class="zs-short-tip fl">张</span>
                <!--<span class="zs-tip">优惠券剩余量！</span>-->
              </td>
            </tr>
            
             <tr class="zs-coupon-tr">
              <td class="zs-td-title ">优惠券有效时间：</td>
              <td>
                <input type="text" id="sp_time" value="" name="quan_dwz" class="zs-input-text " placeholder="" disabled="disabled">
              </td>
            </tr>

            <tr class="zs-price-tr">
              <td class="zs-td-title ">服务费：</td>
              <td class="zs-line-height">
                <input type="text" id="sp_rj" value="" name="yuanjia" class="zs-input-text zs-input-short fl">
                <span class="zs-short-tip fl">元</span>
                <span class="zs-tip">填写此商品在平台推广给平台的费用！</span>
              </td>
            </tr>
            
              <tr class="zs-couponnum-tr">
              <td class="zs-td-title ">商品推广数量：</td>
              <td class="zs-line-height">
                <input type="text" id="promotion" value="" name="promotion_num" class="zs-input-text zs-input-short fl ">
                <span class="zs-short-tip fl">个</span>
                <span class="zs-tip">填写商品要推广的数量！</span>
              </td>
            </tr>
            
             <tr class="zs-price-tr">
              <td class="zs-td-title ">券后价：</td>
              <td class="zs-line-height">
                <input type="text"  id="sp_jhj" value="" name="yuanjia" class="zs-input-text zs-input-short fl">
                <span class="zs-short-tip fl">元</span>
                <span class="zs-tip">领券后拍下价格，如有满减等其他优惠，请务必核实券后价！</span>
              </td>
            </tr>
            
            <tr class="zs-price-tr">
              <td class="zs-td-title ">活动下架时间：</td>
              <td class="zs-line-height">
                <input type="text" class="layui-input" id="end_time" value=""  placeholder="">
                <!--<span class="zs-short-tip fl">天</span>
                <span class="zs-tip"></span>-->
              </td>
            </tr>
            <input type="hidden" value="{$zhiliao.volume}" name="xiaoliang" id="xiaoliang" class="zs-input-text zs-input-short fl">
            <input type="hidden" value="{$zhiliao.item_id}" name="sp_id" id="sp_id" class="zs-input-text zs-input-short fl">
            <input type="hidden" value="" name="yhj_id" id="yhj_id" class="zs-input-text zs-input-short fl">
            
            <tr></tr>
              <tr>
              <td class="zs-td-title"></td>
              <td style="padding: 25px 0 70px">
                <label class="checkbox-inline have-read "><i></i><input name="have-read"  type="checkbox" checked="">我已阅读并了解商品</label><a
                  href="http://www.dataoke.com/hz_tk/gz/?id=541" target="_blank">《信息提交规范》</a>
                <p class="submit-btn zs-tip">
                  <span class="zs-btn-submit fl" onclick=" tijiao()">发布商品</span>
                   </p>
              </td>
            </tr>
          </tbody>
        </table>

        <input name="verify_code" id="input-verify-code" value="" type="hidden">
      </form>
    </div>
</body>
<script>
	
	$(".start_type_now").click(function(e){	
		e.preventDefault();
		$(this).addClass("cur");
		$(this).siblings(".start_type_now").removeClass("cur");
		var th=$(this).find("input").val();
		if(th == 1){
			$(".coupon-start-time").hide();
		}else{
			$(".coupon-start-time").show();
		}
		
	})
	var that = $(".start_type_now.cur").find("input").val();
	if(that == 1){
			$(".coupon-start-time").hide();
		}else{
			$(".coupon-start-time").show();
		}
		
		$('.have-read').click(function(e){
					e.preventDefault();
				$(this).toggleClass("cur");
		})
		
	
		
</script>
</html>